package cn.leaf.observer;

/**
 *
 * desc: 观察者模式测试
 * Spring框架中的应用：
 * ApplicationEvent事件发布
 * ----------------------
 * @author twinkle-leaf
 * @version v1.0.0
 * slogan: There are no two identical leaves in the world.🍃
 *
 */
public class Test {
    public static void main(String[] args) throws InterruptedException {
        UserOne userOne = new UserOne();
        UserTwo userTwo = new UserTwo();
        PeopleDaily peopleDaily = new PeopleDaily();
        peopleDaily.add(userOne);
        peopleDaily.add(userTwo);
        peopleDaily.notifyUsers();

        System.out.println("------------ 开始接收消息 -------------");
        Thread.sleep(2000);

        peopleDaily.setStatus(1);
        peopleDaily.notifyUsers();
    }
}
